<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="../templates/default3.xhtml">         

            <ui:define name="content">

                <h:form id="viewCustomer" binding="#{customerManagerBean.loadUpdateCustomer}">
                   
                    <p:panel header="Customer Information" id="addCustomer1">
                        <table>
                            <tr>
                                <td width ="80px">Employee:</td>
                                <td width="200px"> 
                                    <h:outputText id="userId" value="#{customerManagerBean.userId}"/>
                                </td>
                            </tr>

                            <tr>
                                <td>Email:</td>
                                <td width="200px"> 
                                    <h:outputText id="email" value="#{customerManagerBean.email}" />                                     

                                    <td width="80px">Company:</td>
                                    <td> 
                                        <h:outputText  id="company"  value="#{customerManagerBean.company}" />
                                    </td>
                                </td>
                            </tr>    

                            <tr>
                                <td>First Name:</td>
                                <td> <h:outputText id="fname" value="#{customerManagerBean.firstName}" />                                 
                                </td>

                                <td>Title:</td>
                                <td>                                                                                
                                    <h:outputText id="title" value="#{customerManagerBean.title}" />
                                </td>
                            </tr>
                            
                            <tr>
                                <td>Last Name:</td>
                                <td> <h:outputText id="lname" value="#{customerManagerBean.lastName}" /> 
                                </td>

                                <td>Industry:</td>
                                <td>
                                    <h:outputText id="industry" value="#{customerManagerBean.industry}"/>                  
                                </td>
                            </tr>


                            <tr>
                                <td>Telephone:</td>
                                <td>                                                                                
                                    <h:outputText id="phone" value="#{customerManagerBean.phone}" />
                                </td>

                                <td>Type:</td>
                                <td>
                                    <h:outputText id="type" value="#{customerManagerBean.type}" />                                
                                </td>
                            </tr>
                        </table>
                    </p:panel>
                    
                    <p:panel header="Company Address" id="addCustomer2">
                        <table>
                            <tr >
                                <td width ="80px" valign="top" > Street:</td>
                                <td width="200px" valign="top"> 
                                    <table><tr><td><h:outputText id="street" style="width:160px;height:60px;" value="#{customerManagerBean.street}" />
                                                </td><td> </td></tr></table>                                                                   
                                </td>
                                <td width="80px">City: <br/><br/> Country</td>
                                <td width="200px">
                                    <h:outputText id="city" value="#{customerManagerBean.city}" />                                  
                                    <br/><br/>
                                   <h:outputText id="country" value="#{customerManagerBean.country}"/>                                    
                                </td>
                            </tr>
                            <tr >
                                <td valign ="top" >Postal: </td>
                                <td width="200px" valign ="top"> 
                                    <h:outputText id="postal" value="#{customerManagerBean.postal}" />                                   
                                </td>
                            </tr>
                        </table>
                    </p:panel>

                    <p:panel header="Shipping address" id="addCustomer3">

                        <p:dataTable id="AddressS" var="address" value="#{customerManagerBean.shippingAddresses}" paginator="false" 
                                     selectionMode="single" emptyMessage="No address found with given criteria.">                               

                            <p:column headerText="Street"> 
                                <h:outputText value="#{address.street}" />                                             
                            </p:column> 
                            <p:column headerText="Postal Code"> 
                                <h:outputText value="#{address.postal}" />                                             
                            </p:column> 
                            <p:column headerText="City"> 
                                <h:outputText value="#{address.city}" />                                             
                            </p:column> 
                            <p:column headerText="Country"> 
                                <h:outputText value="#{address.country}" />                                             
                            </p:column> 
                        </p:dataTable>
                    </p:panel>

                    <p:panel header="Billing address" id="addCustomer4">
                       <p:dataTable id="AddressB" var="address" value="#{customerManagerBean.billingAddresses}" paginator="false"                                     
                                     emptyMessage="No address found with given criteria.">     

                            <p:column headerText="Street"> 
                                <h:outputText value="#{address.street}" />                                             
                            </p:column> 
                            <p:column headerText="Postal Code"> 
                                <h:outputText value="#{address.postal}" />                                             
                            </p:column> 
                            <p:column headerText="City"> 
                                <h:outputText value="#{address.city}" />                                             
                            </p:column> 
                            <p:column headerText="Country"> 
                                <h:outputText value="#{address.country}" />                                             
                            </p:column> 
                        </p:dataTable>
                    </p:panel>
                    <p:panel header="Remark (Optional)" id="addCustomer5">
                        <table>
                            <tr>
                                <td width ="80px" valign="top" > Description:</td>
                                <td width="200px" valign="top"> 
                                    <h:outputText id="description" style="width:160px;height:80px;" value="#{customerManagerBean.description}"/>
                                </td>

                                <td width="80px">Annual Revenue: <br/><br/> No. of Employee:</td>
                                <td width="200px">
                                    <h:outputText id="revenue" value="#{customerManagerBean.revenue}"/>

                                    <br/><br/>
                                    <h:outputText id="no_emp" value="#{customerManagerBean.numEmployee}"/>
                                </td>



                            </tr>
                        </table>
                    </p:panel>
                    <table class="panel">
                        <tr>
                            <td class="btn" colspan="3"><p:commandButton id="btnBack" value="Back" actionListener="#{customerManagerBean.back}" />
                            </td>
                        </tr>
                    </table>
                </h:form>
            </ui:define>        
        </ui:composition>
    </body>
</html>
